home *** CD-ROM | disk | FTP | other *** search
- Path: rocannon.cam.harlequin.co.uk!markt
- From: markt@harlqn.co.uk (Mark Tillotson)
- Newsgroups: comp.lang.misc,comp.lang.perl.misc,comp.lang.tcl,comp.lang.c,comp.lang.java
- Subject: Re: Relative Speed of Perl vs. Tcl vs. C [indentation]
- Date: 19 Feb 96 15:18:44 GMT
- Organization: Harlequin Limited, Cambridge, England
- Message-ID: <MARKT.96Feb19151844@atlas.harlqn.co.uk>
- References: <4g0bd6INNn9j@keats.ugrad.cs.ubc.ca> <4g1h0a$l72@orac.mon.rnb.com>
- <MARKT.96Feb16162033@atlas.harlqn.co.uk> <4g8son$gmd@mulga.cs.mu.OZ.AU>
- NNTP-Posting-Host: atlas
- In-reply-to: fjh@munta.cs.mu.OZ.AU's message of 19 Feb 1996 04:02:31 GMT
-
- fjh@munta.cs.mu.OZ.AU (Fergus Henderson) replied:
- > I'm not familiar with Python, but I'm familiar with Haskell, which also
- > uses whitespace to structure code.
- >
- > >linewrap,
- >
- > This is not a problem in Haskell; you just need to make sure that
- > you indent the wrapped part of the line, e.g.
-
- The point is that numerous text editors, word-processing packages,
- mail-handling systems can and do automatically line-wrap, and can thus
- corrupt such programs, and such things don't know the rules for Haskell,
- but always happen to respect the normal notions of whitespace (ie that
- any amount of whitespace is equivalent to any other amount of
- whitespace).
- >
- > this is a very long statement of pseudo-haskell that doesn't quite
- > fit on one line
- >
- > >tabs,
- >
- > So disallow them!
- Again this just makes life difficult when you encounter software that
- replaces spaces by tabs automatically.
-
- >
- > >painful to automatically generate code,
- >
- > In Haskell it is not painful to automatically generate code, because
- > Haskell does not *require* the use of layout to indicate nesting;
- > curly braces and semicolons can be used instead. You can also
- > mix the use of implicit nesting (via layout) and explicit nesting
- > (via curly braces and semicolons).
-
- Well that's my point, that using the conventional notion of language
- as a symbol-sequence, and deploying bracketing constructs, is more
- powerful and useful than trying to treat sourcecode as a 2-D array of
- fixed-width characters.
-
- >
- > >virtually impossible to stream-edit code,
- >
- > Huh? Why?
- OK, how do you automatically merge diff's? Or paste in a common
- piece of code at several different places where the indentation might
- happen to be different?
-
- > >proportional fonts,
- >
- > Even proportional fonts don't have proportional whitespace!
- But proportional-font display techniques don't always respect them,
- and usually the spaces are so narrow (especially in san-serif styles)
- that you can't be sure just be looking if two lines start with the
- same number.
-
- [long list of detailed counter-arguments omitted]
-
- People are used to the notion of programming (and natural) languages
- being relatively context-free, and having the _invisible_ whitespace
- at the start of each line as an unnecessary context-sensitive feature
- can be a real pain and source of confusion, error and bugs. It breaks
- referencial transparency for one thing. It's the sort of mistake
- that's been made before, in the days of punched cards, Fortran and
- Cobol, before enough people understood grammar theory.
-
- There really is no difficulty at all in parsing a normal block-
- structured language and formatting it in a suitably indented form, and
- you get all the benefits of being able to cut/paste without worry, as
- well as the benefit of redundancy. The editor I use everyday can do
- this for a wide range of programming languages, and matches
- brackets/braces automatically too.
-
- (All my personal opinions)
-
- __Mark
- [ markt@harlequin.co.uk | http://www.harlequin.co.uk/ | +44 1223 873829 ]
- [ homepage http://www.hal.com/services/juggle/home/markt@harlequin.co.uk/ ]
-